package net.dengzixu.java.homework.period22;

/**
 * @author Deng Zixu <admin@dengzixu.com>
 */
public class AnimalTest {
    public static void main(String[] args) {
        Dog dog = new Dog();
        Cat cat = new Cat();

        eatTest(dog);
        eatTest(cat);
    }

    public static void eatTest(Animal animal) {
        animal.eat();
    }
}

class Animal {
    public void eat() {
        System.out.println("Animal 想吃点什么。");
    }
}

class Dog extends Animal {
    @Override
    public void eat() {
        System.out.println("Dog 想吃点什么。");
    }
}

class Cat extends Animal {
    @Override
    public void eat() {
        System.out.println("Cat 想吃点什么。");
    }
}